/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simplepushclient;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;

/**
 *
 * @author Filip
 */
public class Helper {
    /**
    * Get the String residing on the clipboard.
    * @return any text found on the Clipboard; if none found, return an
    * empty String.
    */
    public static String getClipboardContents() {
        String result = "";
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        //odd: the Object param of getContents is not currently used
        Transferable contents = clipboard.getContents(null);
        boolean hasTransferableText = (contents != null) && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
        if(hasTransferableText) {
            try {
                result = (String)contents.getTransferData(DataFlavor.stringFlavor);
            }catch (Exception ex) {
                System.out.println(ex);
                ex.printStackTrace();
            }
        }
        return result;
    }
}
class Int{
    private int i;
    public Int(int i) {
        this.i = i;
    }
    public void setIntValue(int i) {
        this.i = i;
    }
    public int getIntValue() {
        return i;
    }
    public String toString() {
        return i+"";
    }
}

